package com.ayz.gateway.server.grpc;

import io.grpc.Attributes;
import io.grpc.Context;
import io.grpc.netty.shaded.io.netty.channel.Channel;

/**
 * @ClassName GrpcServerConstants
 * @Description TODO:GRPC服务端的实例属性列表
 * @Author 快乐的星球
 * @Date 2023/5/19 16:28
 * @Version 1.0
 **/
public class GrpcServerConstants {
    /**
     * 连接通道的ConnectionKey
     */
    public static final Attributes.Key<String> ATTR_TRANS_KEY_CONN_ID = Attributes.Key.create("conn_id");
    /**
     * 客户端的IP地址
     */
    public static final Attributes.Key<String> ATTR_TRANS_KEY_REMOTE_IP = Attributes.Key.create("remote_ip");
    /**
     * 客户端的端口号
     */
    public static final Attributes.Key<Integer> ATTR_TRANS_KEY_REMOTE_PORT = Attributes.Key.create("remote_port");
    /**
     * 服务器监听的端口号
     */
    public static final Attributes.Key<Integer> ATTR_TRANS_KEY_LOCAL_PORT = Attributes.Key.create("local_port");

    public static final Context.Key<String> CONTEXT_KEY_CONN_ID = Context.key("conn_id");

    public static final Context.Key<String> CONTEXT_KEY_CONN_REMOTE_IP = Context.key("remote_ip");

    public static final Context.Key<Integer> CONTEXT_KEY_CONN_REMOTE_PORT = Context.key("remote_port");

    public static final Context.Key<Integer> CONTEXT_KEY_CONN_LOCAL_PORT = Context.key("local_port");

    public static final Context.Key<Channel> CONTEXT_KEY_CHANNEL = Context.key("ctx_channel");
}
